//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2021 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto/tree/main/CodeGenerator. DO NOT EDIT.

import Foundation
import SotoCore

extension SageMakerFeatureStoreRuntime {
    // MARK: Enums

    // MARK: Shapes

    public struct DeleteRecordRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "eventTime", location: .querystring(locationName: "EventTime")),
            AWSMemberEncoding(label: "featureGroupName", location: .uri(locationName: "FeatureGroupName")),
            AWSMemberEncoding(label: "recordIdentifierValueAsString", location: .querystring(locationName: "RecordIdentifierValueAsString"))
        ]

        /// Timestamp indicating when the deletion event occurred. EventTime can be used to query data at a certain point in time.
        public let eventTime: String
        /// The name of the feature group to delete the record from.
        public let featureGroupName: String
        /// The value for the RecordIdentifier that uniquely identifies the record, in string format.
        public let recordIdentifierValueAsString: String

        public init(eventTime: String, featureGroupName: String, recordIdentifierValueAsString: String) {
            self.eventTime = eventTime
            self.featureGroupName = featureGroupName
            self.recordIdentifierValueAsString = recordIdentifierValueAsString
        }

        public func validate(name: String) throws {
            try self.validate(self.eventTime, name: "eventTime", parent: name, max: 358_400)
            try self.validate(self.eventTime, name: "eventTime", parent: name, pattern: ".*")
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, max: 64)
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, min: 1)
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, pattern: "^[a-zA-Z0-9](-*[a-zA-Z0-9])*")
            try self.validate(self.recordIdentifierValueAsString, name: "recordIdentifierValueAsString", parent: name, max: 358_400)
            try self.validate(self.recordIdentifierValueAsString, name: "recordIdentifierValueAsString", parent: name, pattern: ".*")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct FeatureValue: AWSEncodableShape & AWSDecodableShape {
        /// The name of a feature that a feature value corresponds to.
        public let featureName: String
        /// The value associated with a feature, in string format. Note that features types can be String, Integral, or Fractional. This value represents all three types as a string.
        public let valueAsString: String

        public init(featureName: String, valueAsString: String) {
            self.featureName = featureName
            self.valueAsString = valueAsString
        }

        public func validate(name: String) throws {
            try self.validate(self.featureName, name: "featureName", parent: name, max: 64)
            try self.validate(self.featureName, name: "featureName", parent: name, min: 1)
            try self.validate(self.featureName, name: "featureName", parent: name, pattern: "^[a-zA-Z0-9]([-_]*[a-zA-Z0-9])*")
            try self.validate(self.valueAsString, name: "valueAsString", parent: name, max: 358_400)
            try self.validate(self.valueAsString, name: "valueAsString", parent: name, pattern: ".*")
        }

        private enum CodingKeys: String, CodingKey {
            case featureName = "FeatureName"
            case valueAsString = "ValueAsString"
        }
    }

    public struct GetRecordRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "featureGroupName", location: .uri(locationName: "FeatureGroupName")),
            AWSMemberEncoding(label: "featureNames", location: .querystring(locationName: "FeatureName")),
            AWSMemberEncoding(label: "recordIdentifierValueAsString", location: .querystring(locationName: "RecordIdentifierValueAsString"))
        ]

        /// The name of the feature group in which you want to put the records.
        public let featureGroupName: String
        /// List of names of Features to be retrieved. If not specified, the latest value for all the Features are returned.
        public let featureNames: [String]?
        /// The value that corresponds to RecordIdentifier type and uniquely identifies the record in the FeatureGroup.
        public let recordIdentifierValueAsString: String

        public init(featureGroupName: String, featureNames: [String]? = nil, recordIdentifierValueAsString: String) {
            self.featureGroupName = featureGroupName
            self.featureNames = featureNames
            self.recordIdentifierValueAsString = recordIdentifierValueAsString
        }

        public func validate(name: String) throws {
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, max: 64)
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, min: 1)
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, pattern: "^[a-zA-Z0-9](-*[a-zA-Z0-9])*")
            try self.featureNames?.forEach {
                try validate($0, name: "featureNames[]", parent: name, max: 64)
                try validate($0, name: "featureNames[]", parent: name, min: 1)
                try validate($0, name: "featureNames[]", parent: name, pattern: "^[a-zA-Z0-9]([-_]*[a-zA-Z0-9])*")
            }
            try self.validate(self.featureNames, name: "featureNames", parent: name, min: 1)
            try self.validate(self.recordIdentifierValueAsString, name: "recordIdentifierValueAsString", parent: name, max: 358_400)
            try self.validate(self.recordIdentifierValueAsString, name: "recordIdentifierValueAsString", parent: name, pattern: ".*")
        }

        private enum CodingKeys: CodingKey {}
    }

    public struct GetRecordResponse: AWSDecodableShape {
        /// The record you requested. A list of FeatureValues.
        public let record: [FeatureValue]?

        public init(record: [FeatureValue]? = nil) {
            self.record = record
        }

        private enum CodingKeys: String, CodingKey {
            case record = "Record"
        }
    }

    public struct PutRecordRequest: AWSEncodableShape {
        public static var _encoding = [
            AWSMemberEncoding(label: "featureGroupName", location: .uri(locationName: "FeatureGroupName"))
        ]

        /// The name of the feature group that you want to insert the record into.
        public let featureGroupName: String
        /// List of FeatureValues to be inserted. This will be a full over-write. If you only want to update few of the feature values, do the following:   Use GetRecord to retrieve the latest record.   Update the record returned from GetRecord.    Use PutRecord to update feature values.
        public let record: [FeatureValue]

        public init(featureGroupName: String, record: [FeatureValue]) {
            self.featureGroupName = featureGroupName
            self.record = record
        }

        public func validate(name: String) throws {
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, max: 64)
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, min: 1)
            try self.validate(self.featureGroupName, name: "featureGroupName", parent: name, pattern: "^[a-zA-Z0-9](-*[a-zA-Z0-9])*")
            try self.record.forEach {
                try $0.validate(name: "\(name).record[]")
            }
            try self.validate(self.record, name: "record", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case record = "Record"
        }
    }
}
